#pragma once

#include <serialize/serialize.hpp>
#include "../../config.hpp"


namespace dcs {

	struct db_t {
		log_handler_t log_handler_;
		std::string db_path_;

		struct info_t {
			bool has_upload_ = false;
			std::string file_path_;
			std::time_t sampling_time_ = 0;
			std::uint16_t sampling_pt_ = 0;
			std::vector<float> params_;
		};
		std::map<std::tuple<std::string, std::time_t>, info_t> values_;
		

		db_t(const log_handler_t &, const std::string&);

		bool exsit(const std::string&, std::time_t) const;
		void for_each(const std::function<void(const std::string&, std::time_t, const info_t&)>&);
		void insert(const std::string&, std::time_t, const info_t &);
		void done_upload(const std::string&, std::time_t);

	private:
		void save();
	};
}